<?php

/**
 * IndexController - The default controller class
 * 
 * @author
 * @version 
 */

require_once 'Zend/Controller/Action.php';

class BulletinController extends App_Zend_Controller_Action_Shop 
{
	
    public function indexAction() 
    {
		$this->view->styleName = 'bulletin';
		
    	$this->view->assign('current_action','bulletin');
    	$page=$this->_request->getParam('page');
    	$bulletin=new CItem();
    	Zend_Loader::loadClass("CFilter");
    	$itemCounts=$bulletin->getAllItemCounts('bulletin');
    	$pageArray = CFilter::filterPage ( $page, $itemCounts, 10 );
    	$itemArray=$bulletin->getAllItems($pageArray['from'],10,'bulletin');
		Zend_Loader::loadClass("CPage");
    	$pageString = CPage::divPages( $pageArray ['pageNumber'], $pageArray ['page'], ROOT_PATH."/bulletin-index"); //生成分页字符串
    	$this->view->assign ( "pageString", $pageString );
    	$this->view->assign ( "pageArray", $pageArray );
    	$this->view->assign ( "itemArray", $itemArray );
    	
    	$this->view->webSiteTitle = $itemArray[0]['subject'];
    	$this->view->webSiteKeywords = $itemArray[0]['subject'];
    	$this->view->webSiteDescription = mb_substr(strip_tags($itemArray[0]['content']), 0, 100);
    	
    	//SET META FOR FACEBOOK
        $this->getHelper ('layout')->getView()->headMeta()->setName('og:title', $itemArray[0]['subject']);
		$this->getHelper ('layout')->getView()->headMeta()->setName('og:type', 'jersery');
		$this->getHelper ('layout')->getView()->headMeta()->setName('og:url', MY_URL);
		$this->getHelper ('layout')->getView()->headMeta()->setName('og:image', MY_URL.'/images/logo.jpg');
		$this->getHelper ('layout')->getView()->headMeta()->setName('og:site_name', 'newjerseysoccer.net');
		$this->getHelper ('layout')->getView()->headMeta()->setName('og:description', mb_substr(strip_tags($itemArray[0]['content']), 0, 100));
    }
    
    public function moreAction()
    {
		$this->getHelper('Fenlei')->getCategories();
    	$this->view->styleName = 'bulletin-detail';
    	$this->view->assign('current_action','bulletin');
    	$itemid=$this->_request->getParam('itemid');
		$itemidArray=explode('/',$itemid);
		if($itemidArray[1]==''){
			$this->_forward('index','error');
		} else {
	    	$item=new CItem();
	    	$itemArray=$item->getDetail($itemidArray[0],'bulletin');
			$itemArray[0]['subject']=str_replace("GoGoalShop","Newjerseysoccer",$itemArray[0]['subject']);
	    	$this->view->assign ( "itemArray", $itemArray );
	    	$this->view->webSiteTitle = $itemArray[0]['subject'];
    		$this->view->webSiteDescription = mb_substr(strip_tags($itemArray[0]['content']), 0, 100);
    		$this->view->webSiteKeywords = $itemArray[0]['subject'];
    		
    		//SET META FOR FACEBOOK
        $this->getHelper ('layout')->getView()->headMeta()->setName('og:title', $itemArray[0]['subject']);
		$this->getHelper ('layout')->getView()->headMeta()->setName('og:type', 'jersery');
		$this->getHelper ('layout')->getView()->headMeta()->setName('og:url', MY_URL);
		$this->getHelper ('layout')->getView()->headMeta()->setName('og:image', MY_URL.'/images/logo.jpg');
		$this->getHelper ('layout')->getView()->headMeta()->setName('og:site_name', 'newjerseysoccer.net');
		$this->getHelper ('layout')->getView()->headMeta()->setName('og:description', mb_substr(strip_tags($itemArray[0]['content']), 0, 100));
		}
    	
    }

	
	public function postAction(){
	
		//$this->_helper->viewRenderer->setNoRender();
		
		//$this->getHelper ('layout')->disableLayout ();
	
	}
    

    
}
